package demo;

/**
 * 父类转换为子类
 *
 * @author sun.ye
 * @since 2020-05-01 18:27
 */
public class FatherCase {
    public static void main(String[] args) {
        Father father = new Father("孙");
        Sun sun = (Sun) father;

    }
}


class Father{

    private String surname;

    public Father(String surname) {
        this.surname = surname;
    }
}

class Sun extends Father{

    private String name;

    public Sun(String surname) {
        super(surname);
    }
}